package com.weipu.common.facade.impl;

import com.weipu.common.constants.Constant;
import com.weipu.common.facade.exception.DxException;
import com.weipu.common.okhttp.OkHttpHelper;
import com.weipu.common.util.JsonFormat;
import com.weipu.common.util.Logger;

import org.json.JSONObject;

import java.io.IOException;

/**
 * 获取国家代码和IP的服务类
 * @author ZengLW
 * @version 1.0
 * @date 2017/7/19
 */
public class IPCountryServiceProviderImpl extends BaseServiceProviderImpl {

    /**
     * 获取国家的代码
     */
    public String getCountryCode(String action) {
        try {

//            JSONObject data = requestHttpGetData(Constant.GETCOUNTRY_URL + "?headerName=" + action);
            return OkHttpHelper.getOkHttpHelperInstance().syncGetRequest("https://dms.dx.com/AppWeb/v3.0/PaypalFrom/GetHttpHeaderValue"+ "?headerName=" + action, "");
        } catch (DxException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
